﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AdminController;

namespace HPMDesktop.Admin.Wards
{
    public partial class frmBed : Form
    {
        public frmBed()
        {
            InitializeComponent();
        }

        private void frmBed_Load(object sender, EventArgs e)
        {
            string ID;

            //ID = Request.Form("ID");
            ID = "1";

            Bed objData = new Bed();
            Bed_DataLoader objDataLoader = new Bed_DataLoader();

            try
            {

                objData = objDataLoader.Get_Bed_DATA(ID);

                wardID.Text = Convert.ToString(objData.wardID);
                BedNumber.Text = Convert.ToString(objData.BedNumber);
                Description.Text = Convert.ToString(objData.Description);
                BedType.Text = Convert.ToString(objData.BedType);
                BedStatus.Text = Convert.ToString(objData.BedStatus);
                Description.Text = Convert.ToString(objData.Remarks);
            }
            catch (Exception ex)
            {

            }
            finally
            {
                objData.Dispose();
                objDataLoader.Dispose();

            }

        }

        private void cmdSave_Click(object sender, EventArgs e)
        {
            bool result;
            Bed objData = new Bed();
            Bed_Mapper objMapper = new Bed_Mapper();

            objData.BedID = BediID.Text;
            try
            {
                objData.wardID = Convert.ToString(wardID.Text);
                objData.BedNumber = Convert.ToString(BedNumber.Text);
                objData.Description = Convert.ToString(Description.Text);
                objData.BedType = Convert.ToString(BedType.Text);
                objData.BedStatus = Convert.ToString(BedStatus.Text);
                objData.Remarks = Convert.ToString(Description.Text);

                result = objMapper.Load_Bed_DATA(objData.BedID, objData);
            }
            catch (Exception ex)
            {

            }
            finally
            {
                objData.Dispose();
                objMapper.Dispose();

            }

        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
